package com.eascs.workflow.wf.utils;

import org.apache.commons.lang3.StringUtils;

import com.eascs.workflow.common.entity.wf.ProcessTemplate;

public class ProcessCodeBuilder {
	public static String buildCode(ProcessTemplate processTemplate, String referCode, String processType) {
		if (StringUtils.isNotBlank(processTemplate.getProcessPrefix())) {
			return processTemplate.getProcessPrefix() + "_" + referCode;
		}
		if (ProcessTemplate.PROECESS_TYPE_CREDIT.equals(processType)
				|| ProcessTemplate.PROECESS_TYPE_CREDI_FQ.equals(processType)
				|| ProcessTemplate.PROECESS_TYPE_CREDI_BP.equals(processType)) {
			return "ZX_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_INAUDIT.equals(processType)
				|| ProcessTemplate.PROECESS_TYPE_INAUDIT_FQ.equals(processType)
				|| ProcessTemplate.PROECESS_TYPE_INAUDIT_BP.equals(processType)) {
			return "NS_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_DEPOSIT.equals(processType)
				|| ProcessTemplate.PROECESS_TYPE_DEPOSIT_FQ.equals(processType)) {
			return "STZ_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_BANK_REPORT.equals(processType)
				|| ProcessTemplate.PROECESS_TYPE_BANK_REPORT_FQ.equals(processType)
				|| ProcessTemplate.PROECESS_TYPE_SPEC_BANK_REPORT.equals(processType)) {
			return "BKM_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_REFUND_MGR_FEE.equals(processType)
				|| ProcessTemplate.PROECESS_TYPE_REFUND_MGR_FEE_FQ.equals(processType)) {
			return "TFO_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_REFUND_DEPOSIT_RISK.equals(processType)) {
			return "TFG_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_PLACE_ON_FILE.equals(processType)
				|| ProcessTemplate.PROECESS_TYPE_PLACE_ON_FILE_FQ.equals(processType)) {
			return "GD_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_PAY.equals(processType)
				|| ProcessTemplate.PROECESS_TYPE_PAY_FQ.equals(processType)) {
			return "PAY_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_BACK_MONEY.equals(processType)) {
			return "BM_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_ARCHIVE.equals(processType)
				|| ProcessTemplate.PROECESS_TYPE_CREDIT_ARCHIVE.equals(processType)) {
			return "ARCHIVE_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_REQUIREMENT_APP.equals(processType)) {
			return "REQ_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_FINANCE_AUDIT.equals(processType)) {
			return "FA_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_BUS_REQUIREMENT_APP.equals(processType)) {
			return "BUS_REQ_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_HQ_REQUIREMENT_APP.equals(processType)) {
			return "HQ_REQ_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_PARTNERS_AUDIT_BP.equals(processType)) {
			return "PA_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_AUDIT_BP.equals(processType)) {
			return "BP_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_TQ_PAYMENT.equals(processType)) {
			return "TQ_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_REGULAR_CHECK_LOAN_AFTER.equals(processType)) {
			return "CL_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_DC_FED_BACK.equals(processType)) {
			return "DCF_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_PAY_GACZ.equals(processType)) {
			return "GAPAY_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_BORROW_ARCHIVE.equals(processType)) {
			return "GDJY_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_DCJQ.equals(processType)) {
			return "DCJQ_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_SYSTEM_DEV.equals(processType)) {
			return "SD_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_FKZZ.equals(processType)) {
			return "FKZZ_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_DHK.equals(processType)) {
			return "DHK_" + referCode;
		} else if (ProcessTemplate.PROECESS_TYPE_BC_ARCHIVE.equals(processType)) {
			return "GD_" + referCode;
		}
		return null;
	}
}
